#ifndef __HAL_CW2017_H__
#define __HAL_CW2017_H__

#include    "hal_i2c.h"
#include    "hal_board.h"
#include    "osal.h"



/*
    LOGICAL
*/
#define CW2017_INT_EVENT_TEMP_HIGH   0x0001     // temp is high than WARNTH
#define CW2017_INT_EVENT_TEMP_LOW    0x0002     // temp is less then WARNTL
#define CW2017_INT_EVENT_SOC_CHG     0x0004     // soc change 1%
#define CW2017_INT_EVENT_I_OVER      0x0008     // current overload
#define CW2017_INT_EVENT_V_LOW       0x0010     // voltage too low


typedef  osal_event16_msg_t cw2017_event_t;


#if BOARD_CW2017_ENABLE

extern uint8 cw_get_version(uint8* ver);
extern uint8 cw_get_vol(uint16* mv);
extern uint8 cw_get_capacity(uint16* psoc);
extern uint8 cw_get_temp(int16* ptemp);
extern uint8 cw_min_temp_int_onoff(bool enable);
extern uint8 cw_max_temp_int_onoff(bool enable);
extern uint8 cw_soc_change_int_onoff(bool enable);
extern uint8 cw_set_max_temp_alert(int16 temp);
extern uint8 cw_set_min_temp_alert(int16 temp);

//extern uint16 cw_update_data(void);
extern uint8 cw_bat_init(void);

extern uint8 cw2017_sleep(void);

extern uint8 cw2017_restart(void);

extern void HalCw2017Init(void);

extern void HalCw2017RegisterTask(uint8 task_id);

#else

#define cw_get_version()		01
#define cw_get_vol(a)				1
#define cw_get_capacity(a)			1
#define cw_get_temp(a)			    1

#define cw_bat_init()
#define cw2017_sleep()

#define cw2017_restart()

#define HalCw2017RegisterTask(x)

#endif






#endif
